Repository navigation
WO19 G6: portable grammar keyword/directive adoption + py subtree alignment - #858
Merged
Merged
Conversation
The six fn-literal names (upcase/downcase/title_case/reverse/strip/swapcase) join the keyword rule: a bare fn name is never an alias reference or an alias(...) argument, while downcase = any(...) still declares an alias (alias_decl has no keyword guard). All six fn names are stage directives: reverse/strip/swapcase join case_directive with the plain String semantics of Stdlib::Functions as the reference. New .parg sha 169596431e066ec762b69ceb5a21383154e97ed7f3630888032e0b7122a1750e (the generated ts/py parsers pin it).
…s, span rollback Item 4: both \uXXXX and \UXXXX escape spellings decode in the action layer (gki-bel's sub "\U040E" "Ŭ" used to carry the from-value "U040E" and the row never fired). Item 1: the grammar_source sync carries the six-fn-name keyword table (sha 169596431e066ec762b69ceb5a21383154e97ed7f3630888032e0b7122a1750e). Item 3: reverse/strip/swapcase join BUILTIN_FUNCTIONS - stage directives and inline to-funcalls execute with the plain String semantics of ruby Stdlib::Functions (strip uses ruby's ASCII whitespace + NUL set, not python's Unicode-whitespace strip). Item 2: a fn literal in FROM position raises MapLogicError at compile (the former alias fallback said "Alias downcase not found"); any_character keeps its alias path. Item 5: the outside-form block-rule when extension is retired from the parser (canonical rs binds the guard inside the braces; ruby parses the inside form only) - and the PEG gains span rollback so the inside-form block rule with a when guard parses without desyncing the from/to span walk: lookahead bodies and failing sequence/rep/alt branches now drop the speculative spans they recorded (the crash was reproducible with the new grammar on HEAD's peg.py: ValueError 2 unconsumed from/to spans).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two commits, one logical round (the WO19 G6 rulings):
1. Portable grammar (
lib/interscript/isc/grammar/isc.parg)upcasedowncasetitle_casereversestripswapcase) join thekeywordrule. A bare fn name is never an alias reference;downcase = any(...)still declares an alias (alias_decl has no keyword guard). New sha1695964…, pinned by the regenerated ts/py parsers.reverse/strip/swapcasejoincase_directive— all six fn names are stage directives in the artifact-parse grammar.2. py subtree (
interscript-py/)\UXXXXdecodes in the action layer (gki-bel'ssub "\U040E" "Ŭ"used to carry from-value "U040E"; the row never fired). Regression test pins the decodedЎ.reverse/strip/swapcaseinBUILTIN_FUNCTIONS— ruby String semantics (strip = ruby's ASCII whitespace + NUL set, deliberately not python's Unicode-whitespace strip; swapcase = full Unicode mapping, "ß"→"SS" verified against ruby).MapLogicErrorat compile (was: misleading "Alias downcase not found");any_characterkeeps its alias path (primitive spelled as a function atom — kp-kor's constraint rows exercise it).whenextension is retired (canonical rs binds inside the braces; ruby parses the inside form only), and the PEG gains span rollback — lookahead bodies and failing sequence/rep/alt branches drop the speculative from/to spans they recorded. Crash reproduced on the pre-roundpeg.pywith the new grammar (ValueError: 2 unconsumed from/to spans); the span-rollback compile paths fix it.Ruby runtime: no change needed (evidence)
parallel { sub "k" "K" when kur / sub "k" "q" }: rubyKaK(kur-selected) /qaq(unselected) — identical to rs canonical. The audit's "ruby binds it inside" refers to parse placement, where ruby already rejects the outside form like rs.MapLogicError: Wrong type Symbol, expected I::Node::Item).Stdlib::Functionshas had the trio since G8 (the semantics reference).downcase/upcase/title_caseonly — the ruling targets the two portable pargs; the concern layer's fn-literal production already carries all six as item literals.Noted divergence (documented, in-scope per the ruling): the concern grammar still parses only
downcase/upcase/title_caseas stage directives, so ruby's own.iscparsing rejects a barereverse/strip/swapcasedirective line; the artifact-parse grammar (this.parg, consumed by ts/py/rs) accepts all six.Gates
bundle exec rake spec(SKIP_JS=1 SKIP_PYTHON=1) — 431 examples, 0 failures, 11 pendingGOLDEN_ROOT=~/src/interscript pytest— 0 failures (8 skips: model zips absent, known IR-limitation maps)scripts/parse_parity_py.py --hand-rev 7a84260): canonical 432/435, raw 432/435 — the 3 holdouts are exactly the capital-\Umaps (gki-bel, mvd-bel, odni-bel): the generated parser now decodes where the hand parser carried the literal digits; the hand side is the bug this round fixes